import pymysql as ps

db = ps.connect(
    host="localhost",
    port=3306,
    user="root",
    database="crawlerdemo",
    password="458092",
    charset="utf8"
)

#获取操作游标，即操作一个数据库的对象
cursor = db.cursor()

cursor.execute("select * from m_stu")

print(cursor)

#获取一条数据
data = cursor.fetchone()
print(data)

cursor.close()
db.close()